container: Simplify code
authorBenjamin Otte <otte@redhat.com>
Sun, 11 Nov 2012 18:48:41 +0000 (19:48 +0100)
committerBenjamin Otte <otte@redhat.com>
Sun, 11 Nov 2012 19:26:28 +0000 (20:26 +0100)
We will never get allocated a too small size, so no need to handle that
case.

gtk/gtkcontainer.c

index f985173b59d0b67fe1023363d132002e4d20b58e..52eeae8b9799ab5fc4500366e86485e169ca0a19 100644 (file)
@@ -1918,32 +1918,11 @@ gtk_container_adjust_size_allocation (GtkWidget         *widget,
 
   container = GTK_CONTAINER (widget);
 
-  if (!GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
+  if (GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
     {
-      parent_class->adjust_size_allocation (widget, orientation,
-                                            minimum_size, natural_size, allocated_pos,
-                                            allocated_size);
-      return;
-    }
-
-  border_width = container->priv->border_width;
-
-  *allocated_size -= border_width * 2;
-
-  /* If we get a pathological too-small allocation to hold
-   * even the border width, leave all allocation to the actual
-   * widget, and leave x,y unchanged. (GtkWidget's min size is
-   * 1x1 if you're wondering why <1 and not <0)
-   *
-   * As long as we have space, set x,y properly.
-   */
+      border_width = container->priv->border_width;
 
-  if (*allocated_size < 1)
-    {
-      *allocated_size += border_width * 2;
-    }
-  else
-    {
+      *allocated_size -= border_width * 2;
       *allocated_pos += border_width;
       *minimum_size -= border_width * 2;
       *natural_size -= border_width * 2;